package com.sg.business.permission.ui.column;

import org.eclipse.jface.viewers.TableViewer;

import com.sg.business.permission.model.PermissionAction;

public class PermissionCheckColumn extends AbstractCheckColumn {

	private String permission;

	public PermissionCheckColumn(String permission) {
		this.permission = permission;
	}

	@Override
	protected boolean isTrue(PermissionAction action) {
		return permission.equals(action.getPermission());
	}

	@Override
	protected void setValue(TableViewer viewer, PermissionAction action,
			boolean value) {
		if (value) {
			action.setPermission(permission);
		} else {
			action.setPermission(PermissionAction.NONE);
		}
		super.setValue(viewer, action, value);
	}

}
